<template>
  <div class="wrapper">
    <swiper :options="swiperOption" v-if="slist.length>0">
      <swiper-slide class="swiper-item" v-for='item of slist' :key='item.id'>
        <img class='swiper-img' :src='item.imgUrl' />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    slist: Array
  },
  data () {
    return {
      swiperOption: {
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: {
          delay: 2500,
          disableOnInteraction: false
        },
        pagination: {
          el: '.swiper-pagination',
          loop: true,
          clickable: true
        }
      }
    }
  }
}
</script>

<style lang="stylus" scoped="scoped">
  .wrapper >>> .swiper-pagination-bullet-active
    background #FFFFFF
  .wrapper
    height 0
    padding-bottom 28%
    img
      width 100%
      opacity 1
</style>
